package iit.projects.etaxi.model.entity;

import java.io.Serializable;
import java.util.Date;

public class VehicleLocation implements Serializable, Comparable<VehicleLocation> {

	private static final long serialVersionUID = 5572603641298493233L;
	
	private Long id;
	
	private SubCity location;
	
	private String status;
	
	private Date time;
	
	private Vehicle vehicle;
	
	private Reservation reservation;

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public SubCity getLocation() {
		return location;
	}

	public void setLocation(SubCity location) {
		this.location = location;
	}

	public String getStatus() {
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	public Date getTime() {
		return time;
	}

	public void setTime(Date time) {
		this.time = time;
	}

	public Vehicle getVehicle() {
		return vehicle;
	}

	public void setVehicle(Vehicle vehicle) {
		this.vehicle = vehicle;
	}

	public Reservation getReservation() {
		return reservation;
	}

	public void setReservation(Reservation reservation) {
		this.reservation = reservation;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		VehicleLocation other = (VehicleLocation) obj;
		if (getId() == null) {
			if (other.getId() != null)
				return false;
		} else if (!getId().equals(other.getId()))
			return false;
		return true;
	}

	@Override
	public int compareTo(VehicleLocation o) {
		//return o.time.compareTo(this.time);
		return this.time.compareTo(o.time);
	}
	
}
